/******************************************************************************
* File description: experimentsettingui.cpp
* Function: 设置页面
* Current Version: 1.0.0
* Author: 张宇轩
* Date: 2024-08-30
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
#include "experimentsettingui.h"

#include "help.h"
#include "aboutus.h"

ExperimentSettingUI::ExperimentSettingUI() {
    // 初始化
    this->setResizeMode(QQuickWidget::SizeRootObjectToView);
    this->setSource(QUrl("qrc:/experimentSetting.qml"));
    rootObj = this->getRootObject();
    if(rootObj){
        connect(rootObj, SIGNAL(returnSig()), this, SIGNAL(returnSig()));
        connect(rootObj, SIGNAL(changeSettingPage(int)), this, SIGNAL(changeSettingPage(int)));
        connect(rootObj, SIGNAL(aboutUs()), this, SLOT(onAboutUs()));
        connect(rootObj, SIGNAL(help()), this, SLOT(onHelp()));
    }
}

ExperimentSettingUI::~ExperimentSettingUI() {}

/**
 * @brief getContext 获取qmlcontext
 * @return qmlContext
 */
QQmlContext* ExperimentSettingUI::getContext() const
{
    return this->rootContext();
}

/**
 * @brief getRootObject 获取rootObject
 * @return rootObject
 */
QObject* ExperimentSettingUI::getRootObject() const
{
    return (QObject*)this->rootObject();
}

/**
 * @brief 关于我们
 */
void ExperimentSettingUI::onAboutUs()
{
    Help::helpBox(this, "这里是设置帮助");
}

/**
 * @brief 帮助
 */
void ExperimentSettingUI::onHelp()
{
    AboutUs::aboutUsBox(this, "这里是设置的关于我们");
}
